<?php


namespace App\Transformers\System;


use App\Models\SystemCity;
use League\Fractal\TransformerAbstract;

class SystemCityTransformer extends TransformerAbstract
{
    public function transform(SystemCity $data)
    {
        return [
            'id' => $data->id,
            'city_id' => $data->city_id ?? '',
            'parent_id' => $data->parent_id ?? '',
            'level' => $data->level ?? '',
            'area_code' => $data->area_code ?? '',
            'name' => $data->name ?? '',
            'merger_name' => $data->merger_name ?? '',
            'ing' => $data->ing ?? '',
            'lat' => $data->lat ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
